#ifndef _MARIO_GAME_H_
#define _MARIO_GAME_H_

#include <d3dx9.h>

//#include "Global.h"
#include "Game.h"
#include "Sprite.h"
#include "Mario.h"
#include "Turtle.h"
#include "Goomba.h"
#include "Score.h"
#include "Info.h"

#include "Audio.h"
#include "Sample.h"
#include "Camera.h"
#include "Map.h"
#include "Collision.h"


#include "dxaudio.h"
#include <iostream>
using namespace std;

/**--------------------------------------------------------
*Program/Project : GameMario
*Written by : 
*Email :
*Created date : 7/10/2012
*Modified by :
*Modified date :
*Version : 1.0
*Description : Lop khoi tao MarioManager
--------------------------------------------------------**/


class MarioManager: public Game
{
public: 
	LPD3DXSPRITE _spriteHandler;	// SpriteHandler to draw texture
	//protected:
	int num_Score;					//score game
	int num_Life;					//number life of mario
	int num_Coin;					//number coin of mario
	int count_Time;					//time to complete level
	int reset_Time;
	int game_State;					//trang thai game
	int map_Current;				//map chinh dang choi
	int submap;						//map phu
	
	int yPointMenu;					//con tro menu
	int xPointMenu;

	int timeChangeMap;

	//Mario* _marios[10];
	//Mario* save_Mario;
	//Turtle* _tur;
	//Turtle* _tur2;
	Sprite* pointMenu;				//con tro menu	

 
	Camera *camera;
	Map *mapManager;
	vector<Object*> map_list;
	
	QuadTree *quadTree;
	list<Object*>	staticObjs;
	list<Object*>	dynamicObjs;

	//---------DIEM-------//
	Score* scoreArr[6];
	Info* infoArr[6];
	list<Score*> scoreList;
	list<Score*> scoreRemoveList;

	//---------AM THANH-------//
	/*Audio* audio;
	Sample* wobble;*/
	//Audio DirectX
	DxAudio *dxAudio;
	CSound *backgroundSound, *bonusRiseSound, *brickBreakSound, *bumpSound, *coinSound, *deathSound, *fireballSound, *gameOverSound;
	CSound *jumpSound, *kickSound, *lifeSound, *mipSound, *pipeWarpSound, *powerupSound, *startGameSound, *winGameSound;

	

	MarioManager(HINSTANCE hInstance, LPWSTR Name, int Mode, int IsFullScreen, int FrameRate);
	~MarioManager();
	
	virtual void RenderFrame(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, int Delta);
	virtual void ProcessInput(LPDIRECT3DDEVICE9 d3ddv, int Delta);
	virtual void LoadResources(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer);
	//void ProcessInput(); 

	/*virtual void OnKeyDown(int KeyCode);
	virtual void OnKeyUp(int KeyCode);*/

	//Dang them vao
	virtual void Update(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, int Delta);

	void InfoScore(int score, int x, int y);
	void ChangeState(int state);
	void ChangeMap(int map);
	void ChangeSubMap(int submap);
};


#endif